package net.fei.scan.quick.ui

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import net.fei.scan.quick.R
import net.fei.scan.quick.adapter.MainAdapter
import net.fei.scan.quick.databinding.ActivityHistoryBinding
import net.fei.scan.quick.db.DbUtils
import net.fei.scan.quick.entity.History

class HistoryActivity : AppCompatActivity() {
    private lateinit var bin :ActivityHistoryBinding
    private lateinit var list:MutableList<History>
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bin = ActivityHistoryBinding.inflate(layoutInflater)
        setContentView(bin.root)

        addData()
    }

    private fun addData() {
        list = DbUtils(this).getAllData(1) as MutableList<History>
        bin.rcv.apply {
            adapter= MainAdapter(list,this@HistoryActivity)
            layoutManager= LinearLayoutManager(this@HistoryActivity, LinearLayoutManager.VERTICAL, false)
        }
    }
}